package me.yangxy.learning.service;

import org.springframework.stereotype.Service;

import javax.transaction.Transactional;

/**
 * 提供者，server工程的入口
 *
 */
@Transactional
@Service
public class BookServiceProvider {

//    @Autowired
//    private BookDao bookDao;
//
//    @Override
//    public Book getBook(String id) {
//
//        Optional<BookItem> bookResult = bookDao.findById(Long.parseLong(id));
//        BookItem bookItem = bookResult.orElse(new BookItem());
//
//        Book returnObject = new Book();
//        returnObject.setBookId(bookItem.getId());
//        returnObject.setBookPrice(bookItem.getPrice());
//        returnObject.setBookType(bookItem.getType()!=null ? bookItem.getType().getComment() : "");
//        returnObject.setBookTitle(bookItem.getTitle());
//        return returnObject;
//
//    }
//
//    @Override
//    public List<Book> queryNewestBooks() {
//
//        List<BookItem> list = bookDao.findAllByPriceBetween(50,200);
//
//        if(!ObjectUtils.isEmpty(list)){
//            System.out.println(list.get(0));
//        }
//
//        return null;
//    }
//
//    @Override
//    public void addBook(Book newBook) {
//        System.out.println(newBook);
//        System.out.println(newBook);
//    }
}
